# 导包
import requests
import app
# 定义员工管理接口类
class EmployeeAPI():
    # 初始化员工接口地址
    def __init__(self):
        self.add_employee_url = app.BASE_URL + "/api/sys/user"
        self.get_employee_url = app.BASE_URL + "/api/sys/user/{}"
        self.update_employee_url = app.BASE_URL + "/api/sys/user/{}"
        self.delete_employee_url = app.BASE_URL + "/api/sys/user/{}"
    # 添加员工
    def add_employee(self,add_employee_data):
        return requests.post(url=self.add_employee_url,json=add_employee_data,headers=app.headers_data)
    # 查询员工
    def get_employee(self,employee_id):
        url = self.get_employee_url.format(employee_id)
        return requests.get(url=url,headers=app.headers_data)
    # 更新员工
    def update_employee(self,employee_id,update_data):
        url = self.update_employee_url.format(employee_id)
        return requests.put(url=url,json=update_data,headers=app.headers_data)
    # 删除员工
    def delete_employee(self,employee_id):
        url = self.delete_employee_url.format(employee_id)
        return requests.delete(url=url,headers=app.headers_data)